package apiday01;

import java.util.Random;
import java.util.Scanner;
/**
 验证码大小写
 * */
public class CharAtDemo {
    public static void main(String[] args) {
        String s = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
        String c = new String();
        for (int i = 0; i < 4; i++) {
            Random r = new Random();
            c = c+s.charAt(r.nextInt(62));
        }

        System.out.print("需要验证码为：");
        System.out.println(c);
        String n = c.toLowerCase();

        System.out.print("请输入验证码:");
        Scanner scan = new Scanner(System.in);
        String p = scan.next();
        String m = p.toLowerCase();

        if(n.equals(m)){
            System.out.println("验证成功！");
        }else{
            System.out.println("已报警!");
        }
    }

}
